import axios from '@/utils/request'
import {
  IGetPermission,
  IGetPermissionRes,
  IPermission,
} from './types/permissions'

export function getPermissions(params: IGetPermission) {
  return axios<IGetPermissionRes>({
    url: '/api/permission-management/permissions',
    method: 'get',
    params,
  })
}

export function updatePermissions(
  query: IGetPermission,
  payload: Record<string, IPermission[]>,
) {
  return axios({
    url: '/api/permission-management/permissions',
    method: 'put',
    params: query,
    data: payload,
  })
}
